/*
package com.itheima.controller.backend.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@EnableWebSecurity
@Configuration
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {

    @Bean
    public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {
        return authenticationConfiguration.getAuthenticationManager();
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.authorizeRequests()
                .antMatchers("/backend/**").authenticated()
                .antMatchers("/backend/login").permitAll()
                .anyRequest().permitAll()
                .and()
                    .formLogin()
                        .loginPage("/backend/login.html")
                        .loginProcessingUrl("/backend/login")
                        .defaultSuccessUrl("/backend/index.html")
                        .failureUrl("/backend/login.html?error").permitAll();
    }
}
*/
